package cn.edu.hit.ht.controller;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@Controller
public class HelloWorldController {

    @RequestMapping(value="/",method=RequestMethod.GET)
    public String helloWorld(Model model, HttpServletRequest request ){
        model.addAttribute("title", "欢迎");
        // 文本表达式
        model.addAttribute("name", "ywj");
       // 显示html效果
        model.addAttribute("html", "<b>BBB</b>");
        // 数组
        String[] arr = {"a", "b"};
        model.addAttribute("arr", arr);
        // url
        model.addAttribute("url", "http://www.baidu.com");
        model.addAttribute("today", new Date());
        return "index";
    }

}
